﻿<documents created="2010-12-15 11:42:59Z"><document src="C:\Users\Anders\Documents\automatones\Visual Studio\AutomaTones\AutomaTones\Model\MIDI\Mappers\MozartTranslator.cs" renderPrefix="s0"><chunk hits="-1" domain="unknown"><source><![CDATA[using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Midi;
using AutomaTones.Model.Automaton_Model;
using Microsoft.Pex.Framework;

namespace AutomaTones.Model.MIDI.Mappers
{
    [PexClass]
    partial class MozartTranslator : IMapper
    {
        private readonly List<NoteOut> _notes = new List<NoteOut>();
        bool switcher=false;
        int noteTranslator=12;

        [PexMethod]
        public List<NoteOut> Translate(State[,] grid) ]]></source>
</chunk>
<method name="Translate" namespace="AutomaTones.Model.MIDI.Mappers" type="AutomaTones.Model.MIDI.Mappers.MozartTranslator" typeName="MozartTranslator" token="60001e6" module="AutomaTones.exe"><hits><hit index="0" value="1"/>
<hit index="1" value="1"/>
<hit index="3" value="1"/>
<hit index="4" value="1"/>
<hit index="5" value="1"/>
<hit index="6" value="1"/>
<hit index="7" value="1"/>
<hit index="8" value="2"/>
<hit index="9" value="1"/>
<hit index="10" value="1"/>
<hit index="11" value="1"/>
<hit index="12" value="1"/>
<hit index="13" value="1"/>
<hit index="14" value="1"/>
<hit index="15" value="1"/>
<hit index="16" value="1"/>
<hit index="17" value="11"/>
<hit index="18" value="11"/>
<hit index="19" value="10"/>
<hit index="20" value="10"/>
<hit index="21" value="10"/>
<hit index="22" value="10"/>
<hit index="23" value="20"/>
<hit index="24" value="5"/>
<hit index="25" value="5"/>
<hit index="26" value="5"/>
<hit index="27" value="5"/>
<hit index="28" value="5"/>
<hit index="29" value="5"/>
<hit index="30" value="5"/>
<hit index="31" value="10"/>
<hit index="32" value="4"/>
<hit index="33" value="4"/>
<hit index="34" value="4"/>
<hit index="35" value="4"/>
<hit index="36" value="4"/>
<hit index="37" value="4"/>
<hit index="38" value="8"/>
<hit index="39" value="4"/>
<hit index="41" value="4"/>
<hit index="42" value="4"/>
<hit index="43" value="4"/>
<hit index="44" value="4"/>
<hit index="45" value="8"/>
<hit index="46" value="2"/>
<hit index="47" value="2"/>
<hit index="48" value="2"/>
<hit index="49" value="2"/>
<hit index="50" value="2"/>
<hit index="51" value="2"/>
<hit index="52" value="4"/>
<hit index="53" value="1"/>
<hit index="54" value="1"/>
<hit index="55" value="1"/>
<hit index="56" value="1"/>
<hit index="57" value="1"/>
<hit index="58" value="1"/>
<hit index="59" value="2"/>
<hit index="60" value="1"/>
<hit index="62" value="1"/>
<hit index="63" value="1"/>
<hit index="64" value="1"/>
<hit index="65" value="1"/>
<hit index="66" value="2"/>
<hit index="67" value="2"/>
<hit index="68" value="2"/>
<hit index="69" value="2"/>
<hit index="70" value="2"/>
<hit index="71" value="2"/>
<hit index="72" value="2"/>
<hit index="73" value="4"/>
<hit index="74" value="2"/>
<hit index="75" value="2"/>
<hit index="76" value="2"/>
<hit index="77" value="2"/>
<hit index="78" value="2"/>
<hit index="79" value="2"/>
<hit index="80" value="4"/>
<hit index="81" value="2"/>
<hit index="83" value="2"/>
<hit index="84" value="2"/>
<hit index="85" value="2"/>
<hit index="86" value="2"/>
<hit index="87" value="4"/>
<hit index="88" value="1"/>
<hit index="89" value="1"/>
<hit index="90" value="1"/>
<hit index="91" value="1"/>
<hit index="92" value="1"/>
<hit index="93" value="1"/>
<hit index="94" value="2"/>
<hit index="95" value="1"/>
<hit index="96" value="1"/>
<hit index="97" value="1"/>
<hit index="98" value="1"/>
<hit index="99" value="1"/>
<hit index="100" value="1"/>
<hit index="101" value="2"/>
<hit index="102" value="1"/>
<hit index="104" value="1"/>
<hit index="105" value="1"/>
<hit index="106" value="1"/>
<hit index="107" value="1"/>
<hit index="108" value="2"/>
<hit index="109" value="1"/>
<hit index="110" value="1"/>
<hit index="111" value="1"/>
<hit index="112" value="1"/>
<hit index="113" value="1"/>
<hit index="114" value="1"/>
<hit index="115" value="2"/>
<hit index="116" value="1"/>
<hit index="117" value="1"/>
<hit index="118" value="1"/>
<hit index="119" value="1"/>
<hit index="120" value="1"/>
<hit index="121" value="1"/>
<hit index="122" value="2"/>
<hit index="123" value="1"/>
<hit index="125" value="1"/>
<hit index="126" value="1"/>
<hit index="127" value="1"/>
<hit index="128" value="1"/>
<hit index="129" value="2"/>
<hit index="130" value="13"/>
<hit index="131" value="3"/>
<hit index="132" value="7"/>
<hit index="133" value="1"/>
<hit index="134" value="1"/>
<hit index="135" value="1"/>
<hit index="136" value="1"/>
<hit index="137" value="1"/>
<hit index="138" value="1"/>
<hit index="139" value="6"/>
<hit index="140" value="2"/>
<hit index="141" value="2"/>
<hit index="142" value="1"/>
<hit index="143" value="1"/>
<hit index="144" value="1"/>
<hit index="145" value="11"/>
<hit index="146" value="7"/>
<hit index="147" value="1"/>
<hit index="148" value="1"/>
</hits>
<tags><tag offset="00e4">call to uninstrumented method System.Int32 System.Random.Next(System.Int32 maxValue)</tag>
</tags>
<coverage domain="userortestcode" unit="block" covered="42" total="42" coveredRatio="1"/>
</method>
<chunk hits="1" offset="0000" domain="userortestcode"><source><![CDATA[{]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            ]]></source>
</chunk>
<chunk hits="1" offset="0001" domain="userortestcode"><source><![CDATA[Random random = new Random();]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            ]]></source>
</chunk>
<chunk hits="1" offset="0007" domain="userortestcode"><source><![CDATA[_notes.Clear();]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            ]]></source>
</chunk>
<chunk hits="3" offset="0013" domain="userortestcode"><source><![CDATA[if (switcher)]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[ ]]></source>
</chunk>
<chunk hits="1" offset="0022" domain="userortestcode"><source><![CDATA[{]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                ]]></source>
</chunk>
<chunk hits="1" offset="0023" domain="userortestcode"><source><![CDATA[noteTranslator *= -1;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            ]]></source>
</chunk>
<chunk hits="2" offset="0031" domain="userortestcode"><source><![CDATA[}]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            else ]]></source>
</chunk>
<chunk hits="1" offset="0034" domain="userortestcode"><source><![CDATA[{]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                ]]></source>
</chunk>
<chunk hits="1" offset="0035" domain="userortestcode"><source><![CDATA[noteTranslator *= -1;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            ]]></source>
</chunk>
<chunk hits="2" offset="0043" domain="userortestcode"><source><![CDATA[}]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            for (]]></source>
</chunk>
<chunk hits="4" offset="0044" domain="userortestcode"><source><![CDATA[int x = 0;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[ ]]></source>
</chunk>
<chunk hits="34" offset="01e3" domain="userortestcode"><source><![CDATA[x < grid.GetLength(0)]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[;]]></source>
</chunk>
<chunk hits="30" offset="01df" domain="userortestcode"><source><![CDATA[x++]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[)
                for (]]></source>
</chunk>
<chunk hits="7" offset="004b" domain="userortestcode"><source><![CDATA[int y = 0;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[ ]]></source>
</chunk>
<chunk hits="14" offset="01cc" domain="userortestcode"><source><![CDATA[y < grid.GetLength(1)]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[; ]]></source>
</chunk>
<chunk hits="7" offset="01c8" domain="userortestcode"><source><![CDATA[y++]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[)
                    ]]></source>
</chunk>
<chunk hits="11" offset="0052" domain="userortestcode"><source><![CDATA[if (grid[x, y].CurrentState > 0)]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[ ]]></source>
</chunk>
<chunk hits="5" offset="006e" domain="userortestcode"><source><![CDATA[{]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                        ]]></source>
</chunk>
<chunk hits="5" offset="006f" domain="userortestcode"><source><![CDATA[if (grid[x, y].CurrentState == 1)]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[ ]]></source>
</chunk>
<chunk hits="4" offset="0088" domain="userortestcode"><source><![CDATA[{]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                            ]]></source>
</chunk>
<chunk hits="4" offset="0089" domain="userortestcode"><source><![CDATA[_notes.Add(new NoteOut(Pitch.C1+noteTranslator, random.Next(128)));]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                            ]]></source>
</chunk>
<chunk hits="12" offset="00b0" domain="userortestcode"><source><![CDATA[break;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                        }
                        ]]></source>
</chunk>
<chunk hits="2" offset="00b5" domain="userortestcode"><source><![CDATA[if (grid[x, y].CurrentState == 2)]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                        ]]></source>
</chunk>
<chunk hits="1" offset="00ce" domain="userortestcode"><source><![CDATA[{]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                            ]]></source>
</chunk>
<chunk hits="1" offset="00cf" domain="userortestcode" tag="true"><tooltip><![CDATA[call to uninstrumented method System.Int32 System.Random.Next(System.Int32 maxValue)]]></tooltip>
<source><![CDATA[_notes.Add(new NoteOut(Pitch.A2 - noteTranslator, random.Next(128)));]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                            ]]></source>
</chunk>
<chunk hits="3" offset="00f6" domain="userortestcode"><source><![CDATA[break;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                        }
                        ]]></source>
</chunk>
<chunk hits="2" offset="00fb" domain="userortestcode"><source><![CDATA[if (grid[x, y].CurrentState == 3)]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[ ]]></source>
</chunk>
<chunk hits="2" offset="0114" domain="userortestcode"><source><![CDATA[{]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                            ]]></source>
</chunk>
<chunk hits="2" offset="0115" domain="userortestcode"><source><![CDATA[_notes.Add(new NoteOut(Pitch.E0 + noteTranslator, random.Next(128)));]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                            ]]></source>
</chunk>
<chunk hits="6" offset="013c" domain="userortestcode"><source><![CDATA[break;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                        }
                        ]]></source>
</chunk>
<chunk hits="1" offset="0141" domain="userortestcode"><source><![CDATA[if (grid[x, y].CurrentState == 4)]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                        ]]></source>
</chunk>
<chunk hits="1" offset="015a" domain="userortestcode"><source><![CDATA[{]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                            ]]></source>
</chunk>
<chunk hits="1" offset="015b" domain="userortestcode"><source><![CDATA[_notes.Add(new NoteOut(Pitch.F0 - noteTranslator, random.Next(128)));]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                            ]]></source>
</chunk>
<chunk hits="3" offset="0182" domain="userortestcode"><source><![CDATA[break;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                        }
                        ]]></source>
</chunk>
<chunk hits="1" offset="0184" domain="userortestcode"><source><![CDATA[if (grid[x, y].CurrentState == 5)]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[ ]]></source>
</chunk>
<chunk hits="1" offset="019d" domain="userortestcode"><source><![CDATA[{]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                            ]]></source>
</chunk>
<chunk hits="1" offset="019e" domain="userortestcode"><source><![CDATA[_notes.Add(new NoteOut(Pitch.D0 + noteTranslator, random.Next(128)));]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                            ]]></source>
</chunk>
<chunk hits="3" offset="01c5" domain="userortestcode"><source><![CDATA[break;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
                        }
                    ]]></source>
</chunk>
<chunk hits="1" offset="01c7" domain="userortestcode"><source><![CDATA[}]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            ]]></source>
</chunk>
<chunk hits="1" offset="01f6" domain="userortestcode"><source><![CDATA[switcher = !switcher;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            ]]></source>
</chunk>
<chunk hits="2" offset="0205" domain="userortestcode"><source><![CDATA[return _notes;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
        ]]></source>
</chunk>
<chunk hits="1" offset="020e" domain="userortestcode"><source><![CDATA[}]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
    }
}
]]></source>
</chunk>
</document>
<document src="C:\Users\Anders\Documents\automatones\Visual Studio\AutomaTones\AutomaTones\Model\Automaton Model\State.cs" renderPrefix="s1"><chunk hits="-1" domain="unknown"><source><![CDATA[using System;
using System.Diagnostics.Contracts;

namespace AutomaTones.Model.Automaton_Model {
    /// <author>Anders Øland / anoe@itu.dk</author>
    /// <summary>
    /// The state of a cell represented by a discrete value within a given state space.. 
    /// NOTE: Ideally this would be implemented using generics so states could also be decimals.
    /// NOTE: But due to C#'s lack of type constraint options on value types - this was omitted.
    /// </summary>
    [Serializable]
    public class State {
        /// <summary>
        /// The lower boundary of the state space.
        /// </summary>
        public int SpaceMin { get; protected set; }

        /// <summary>
        /// The upper boundary of the state space.
        /// </summary>
        public int SpaceMax { get; protected set; }

        private int _currentState;

        /// <summary>
        /// Current state.
        /// </summary>
        public int CurrentState {
            get ]]></source>
</chunk>
<method name="get_CurrentState" namespace="AutomaTones.Model.Automaton_Model" type="AutomaTones.Model.Automaton_Model.State" typeName="State" token="60001ce" module="AutomaTones.exe"><hits><hit index="0" value="20"/>
<hit index="1" value="20"/>
</hits>
<coverage domain="userortestcode" unit="block" covered="1" total="1" coveredRatio="1"/>
</method>
<chunk hits="20" offset="0000" domain="userortestcode"><source><![CDATA[{]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[ ]]></source>
</chunk>
<chunk hits="20" offset="0001" domain="userortestcode"><source><![CDATA[return _currentState;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[ ]]></source>
</chunk>
<chunk hits="20" offset="000a" domain="userortestcode"><source><![CDATA[}]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            protected internal set {
                Contract.Ensures(CurrentState == value);
                _currentState = value;
            }
        }

        private int _nextState;

        /// <summary>
        /// Next state.
        /// </summary>
        public int NextState {
            get { return _nextState; }
            protected internal set {
                Contract.Ensures(NextState == value);
                _nextState = value;
            }
        }

        /// <summary>
        /// Construct a new State. 
        /// </summary>
        /// <param name="spaceMin"></param>
        /// <param name="spaceMax"></param>
        /// <param name="currentState"></param>
        public State(int spaceMin = 0, int spaceMax = 1, int currentState = 0) {
            SpaceMin = spaceMin;
            SpaceMax = spaceMax;
            _currentState = currentState;
        }

        [ContractInvariantMethod]
        private void ObjInvariant() {
            Contract.Invariant(SpaceMin < SpaceMax);
            Contract.Invariant(SpaceMin <= _currentState && SpaceMax >= _currentState);
            Contract.Invariant(SpaceMin <= _nextState && SpaceMax >= _nextState);
        }
    }
}]]></source>
</chunk>
</document>
<document src="C:\Users\Anders\Documents\automatones\Visual Studio\AutomaTones\AutomaTones\Model\MIDI\NoteOut.cs" renderPrefix="s2"><chunk hits="-1" domain="unknown"><source><![CDATA[using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using Midi;

namespace AutomaTones.Model.MIDI
{
    /// <summary>
    /// NoteOut is a connector used for transporting the data we need for sending MidiOutput with the MidiOut class.
    /// </summary>
    /// <author>Anders Bech Mellson, anbh@itu.dk</author>
    class NoteOut {
        public Pitch Pitch;
        public int Velocity;
        public int Controller;
        public int ControllerValue;

        /// <summary>
        /// Constructs a NoteOut connector.
        /// It can hold both Midi note data and controller data.
        /// However the controller data has default values,
        /// since it's most common to use the notes.
        /// </summary>
        ]]></source>
</chunk>
<method name=".ctor" namespace="AutomaTones.Model.MIDI" type="AutomaTones.Model.MIDI.NoteOut" typeName="NoteOut" token="6000160" module="AutomaTones.exe"><hits><hit index="0" value="5"/>
<hit index="1" value="5"/>
<hit index="2" value="5"/>
<hit index="3" value="5"/>
<hit index="4" value="5"/>
<hit index="5" value="5"/>
<hit index="6" value="5"/>
<hit index="7" value="5"/>
<hit index="8" value="5"/>
<hit index="9" value="5"/>
<hit index="10" value="5"/>
</hits>
<coverage domain="userortestcode" unit="block" covered="2" total="2" coveredRatio="1"/>
</method>
<chunk hits="5" offset="0000" domain="userortestcode"><source><![CDATA[public NoteOut(Pitch pitch, int velocity, int controller=0,int controllerValue=0)]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[ ]]></source>
</chunk>
<chunk hits="5" offset="0007" domain="userortestcode"><source><![CDATA[{]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            ]]></source>
</chunk>
<chunk hits="5" offset="0008" domain="userortestcode"><source><![CDATA[Pitch = pitch;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            ]]></source>
</chunk>
<chunk hits="10" offset="000f" domain="userortestcode"><source><![CDATA[Velocity = velocity;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            ]]></source>
</chunk>
<chunk hits="10" offset="0016" domain="userortestcode"><source><![CDATA[this.Controller = controller;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
            ]]></source>
</chunk>
<chunk hits="10" offset="001d" domain="userortestcode"><source><![CDATA[this.ControllerValue = controllerValue;]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
        ]]></source>
</chunk>
<chunk hits="10" offset="0025" domain="userortestcode"><source><![CDATA[}]]></source>
</chunk>
<chunk hits="-1" domain="unknown"><source><![CDATA[
    }
}
]]></source>
</chunk>
</document>
</documents>
